package qldc.pm.tienan.service.persistence;

import com.liferay.portal.kernel.bean.PortletBeanLocatorUtil;
import com.liferay.portal.kernel.dao.orm.DynamicQuery;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.ReferenceRegistry;
import com.liferay.portal.service.ServiceContext;

import qldc.pm.tienan.model.TienAn;

import java.util.List;

/**
 * The persistence utility for the tien an service. This utility wraps {@link TienAnPersistenceImpl} and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author Brian Wing Shun Chan
 * @see TienAnPersistence
 * @see TienAnPersistenceImpl
 * @generated
 */
public class TienAnUtil {
    private static TienAnPersistence _persistence;

    /*
     * NOTE FOR DEVELOPERS:
     *
     * Never modify this class directly. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
     */

    /**
     * @see com.liferay.portal.service.persistence.BasePersistence#clearCache()
     */
    public static void clearCache() {
        getPersistence().clearCache();
    }

    /**
     * @see com.liferay.portal.service.persistence.BasePersistence#clearCache(com.liferay.portal.model.BaseModel)
     */
    public static void clearCache(TienAn tienAn) {
        getPersistence().clearCache(tienAn);
    }

    /**
     * @see com.liferay.portal.service.persistence.BasePersistence#countWithDynamicQuery(DynamicQuery)
     */
    public static long countWithDynamicQuery(DynamicQuery dynamicQuery)
        throws SystemException {
        return getPersistence().countWithDynamicQuery(dynamicQuery);
    }

    /**
     * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery)
     */
    public static List<TienAn> findWithDynamicQuery(DynamicQuery dynamicQuery)
        throws SystemException {
        return getPersistence().findWithDynamicQuery(dynamicQuery);
    }

    /**
     * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int)
     */
    public static List<TienAn> findWithDynamicQuery(DynamicQuery dynamicQuery,
        int start, int end) throws SystemException {
        return getPersistence().findWithDynamicQuery(dynamicQuery, start, end);
    }

    /**
     * @see com.liferay.portal.service.persistence.BasePersistence#findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
     */
    public static List<TienAn> findWithDynamicQuery(DynamicQuery dynamicQuery,
        int start, int end, OrderByComparator orderByComparator)
        throws SystemException {
        return getPersistence()
                   .findWithDynamicQuery(dynamicQuery, start, end,
            orderByComparator);
    }

    /**
     * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel)
     */
    public static TienAn update(TienAn tienAn) throws SystemException {
        return getPersistence().update(tienAn);
    }

    /**
     * @see com.liferay.portal.service.persistence.BasePersistence#update(com.liferay.portal.model.BaseModel, ServiceContext)
     */
    public static TienAn update(TienAn tienAn, ServiceContext serviceContext)
        throws SystemException {
        return getPersistence().update(tienAn, serviceContext);
    }

    /**
    * Returns all the tien ans where doiTuongTienAnId = &#63;.
    *
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @return the matching tien ans
    * @throws SystemException if a system exception occurred
    */
    public static java.util.List<qldc.pm.tienan.model.TienAn> findByDoiTuongTienAnId(
        long doiTuongTienAnId)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence().findByDoiTuongTienAnId(doiTuongTienAnId);
    }

    /**
    * Returns a range of all the tien ans where doiTuongTienAnId = &#63;.
    *
    * <p>
    * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.TienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
    * </p>
    *
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @param start the lower bound of the range of tien ans
    * @param end the upper bound of the range of tien ans (not inclusive)
    * @return the range of matching tien ans
    * @throws SystemException if a system exception occurred
    */
    public static java.util.List<qldc.pm.tienan.model.TienAn> findByDoiTuongTienAnId(
        long doiTuongTienAnId, int start, int end)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence()
                   .findByDoiTuongTienAnId(doiTuongTienAnId, start, end);
    }

    /**
    * Returns an ordered range of all the tien ans where doiTuongTienAnId = &#63;.
    *
    * <p>
    * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.TienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
    * </p>
    *
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @param start the lower bound of the range of tien ans
    * @param end the upper bound of the range of tien ans (not inclusive)
    * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
    * @return the ordered range of matching tien ans
    * @throws SystemException if a system exception occurred
    */
    public static java.util.List<qldc.pm.tienan.model.TienAn> findByDoiTuongTienAnId(
        long doiTuongTienAnId, int start, int end,
        com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence()
                   .findByDoiTuongTienAnId(doiTuongTienAnId, start, end,
            orderByComparator);
    }

    /**
    * Returns the first tien an in the ordered set where doiTuongTienAnId = &#63;.
    *
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
    * @return the first matching tien an
    * @throws qldc.pm.tienan.NoSuchTienAnException if a matching tien an could not be found
    * @throws SystemException if a system exception occurred
    */
    public static qldc.pm.tienan.model.TienAn findByDoiTuongTienAnId_First(
        long doiTuongTienAnId,
        com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
        throws com.liferay.portal.kernel.exception.SystemException,
            qldc.pm.tienan.NoSuchTienAnException {
        return getPersistence()
                   .findByDoiTuongTienAnId_First(doiTuongTienAnId,
            orderByComparator);
    }

    /**
    * Returns the first tien an in the ordered set where doiTuongTienAnId = &#63;.
    *
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
    * @return the first matching tien an, or <code>null</code> if a matching tien an could not be found
    * @throws SystemException if a system exception occurred
    */
    public static qldc.pm.tienan.model.TienAn fetchByDoiTuongTienAnId_First(
        long doiTuongTienAnId,
        com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence()
                   .fetchByDoiTuongTienAnId_First(doiTuongTienAnId,
            orderByComparator);
    }

    /**
    * Returns the last tien an in the ordered set where doiTuongTienAnId = &#63;.
    *
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
    * @return the last matching tien an
    * @throws qldc.pm.tienan.NoSuchTienAnException if a matching tien an could not be found
    * @throws SystemException if a system exception occurred
    */
    public static qldc.pm.tienan.model.TienAn findByDoiTuongTienAnId_Last(
        long doiTuongTienAnId,
        com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
        throws com.liferay.portal.kernel.exception.SystemException,
            qldc.pm.tienan.NoSuchTienAnException {
        return getPersistence()
                   .findByDoiTuongTienAnId_Last(doiTuongTienAnId,
            orderByComparator);
    }

    /**
    * Returns the last tien an in the ordered set where doiTuongTienAnId = &#63;.
    *
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
    * @return the last matching tien an, or <code>null</code> if a matching tien an could not be found
    * @throws SystemException if a system exception occurred
    */
    public static qldc.pm.tienan.model.TienAn fetchByDoiTuongTienAnId_Last(
        long doiTuongTienAnId,
        com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence()
                   .fetchByDoiTuongTienAnId_Last(doiTuongTienAnId,
            orderByComparator);
    }

    /**
    * Returns the tien ans before and after the current tien an in the ordered set where doiTuongTienAnId = &#63;.
    *
    * @param tienAnId the primary key of the current tien an
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
    * @return the previous, current, and next tien an
    * @throws qldc.pm.tienan.NoSuchTienAnException if a tien an with the primary key could not be found
    * @throws SystemException if a system exception occurred
    */
    public static qldc.pm.tienan.model.TienAn[] findByDoiTuongTienAnId_PrevAndNext(
        long tienAnId, long doiTuongTienAnId,
        com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
        throws com.liferay.portal.kernel.exception.SystemException,
            qldc.pm.tienan.NoSuchTienAnException {
        return getPersistence()
                   .findByDoiTuongTienAnId_PrevAndNext(tienAnId,
            doiTuongTienAnId, orderByComparator);
    }

    /**
    * Removes all the tien ans where doiTuongTienAnId = &#63; from the database.
    *
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @throws SystemException if a system exception occurred
    */
    public static void removeByDoiTuongTienAnId(long doiTuongTienAnId)
        throws com.liferay.portal.kernel.exception.SystemException {
        getPersistence().removeByDoiTuongTienAnId(doiTuongTienAnId);
    }

    /**
    * Returns the number of tien ans where doiTuongTienAnId = &#63;.
    *
    * @param doiTuongTienAnId the doi tuong tien an ID
    * @return the number of matching tien ans
    * @throws SystemException if a system exception occurred
    */
    public static int countByDoiTuongTienAnId(long doiTuongTienAnId)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence().countByDoiTuongTienAnId(doiTuongTienAnId);
    }

    /**
    * Caches the tien an in the entity cache if it is enabled.
    *
    * @param tienAn the tien an
    */
    public static void cacheResult(qldc.pm.tienan.model.TienAn tienAn) {
        getPersistence().cacheResult(tienAn);
    }

    /**
    * Caches the tien ans in the entity cache if it is enabled.
    *
    * @param tienAns the tien ans
    */
    public static void cacheResult(
        java.util.List<qldc.pm.tienan.model.TienAn> tienAns) {
        getPersistence().cacheResult(tienAns);
    }

    /**
    * Creates a new tien an with the primary key. Does not add the tien an to the database.
    *
    * @param tienAnId the primary key for the new tien an
    * @return the new tien an
    */
    public static qldc.pm.tienan.model.TienAn create(long tienAnId) {
        return getPersistence().create(tienAnId);
    }

    /**
    * Removes the tien an with the primary key from the database. Also notifies the appropriate model listeners.
    *
    * @param tienAnId the primary key of the tien an
    * @return the tien an that was removed
    * @throws qldc.pm.tienan.NoSuchTienAnException if a tien an with the primary key could not be found
    * @throws SystemException if a system exception occurred
    */
    public static qldc.pm.tienan.model.TienAn remove(long tienAnId)
        throws com.liferay.portal.kernel.exception.SystemException,
            qldc.pm.tienan.NoSuchTienAnException {
        return getPersistence().remove(tienAnId);
    }

    public static qldc.pm.tienan.model.TienAn updateImpl(
        qldc.pm.tienan.model.TienAn tienAn)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence().updateImpl(tienAn);
    }

    /**
    * Returns the tien an with the primary key or throws a {@link qldc.pm.tienan.NoSuchTienAnException} if it could not be found.
    *
    * @param tienAnId the primary key of the tien an
    * @return the tien an
    * @throws qldc.pm.tienan.NoSuchTienAnException if a tien an with the primary key could not be found
    * @throws SystemException if a system exception occurred
    */
    public static qldc.pm.tienan.model.TienAn findByPrimaryKey(long tienAnId)
        throws com.liferay.portal.kernel.exception.SystemException,
            qldc.pm.tienan.NoSuchTienAnException {
        return getPersistence().findByPrimaryKey(tienAnId);
    }

    /**
    * Returns the tien an with the primary key or returns <code>null</code> if it could not be found.
    *
    * @param tienAnId the primary key of the tien an
    * @return the tien an, or <code>null</code> if a tien an with the primary key could not be found
    * @throws SystemException if a system exception occurred
    */
    public static qldc.pm.tienan.model.TienAn fetchByPrimaryKey(long tienAnId)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence().fetchByPrimaryKey(tienAnId);
    }

    /**
    * Returns all the tien ans.
    *
    * @return the tien ans
    * @throws SystemException if a system exception occurred
    */
    public static java.util.List<qldc.pm.tienan.model.TienAn> findAll()
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence().findAll();
    }

    /**
    * Returns a range of all the tien ans.
    *
    * <p>
    * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.TienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
    * </p>
    *
    * @param start the lower bound of the range of tien ans
    * @param end the upper bound of the range of tien ans (not inclusive)
    * @return the range of tien ans
    * @throws SystemException if a system exception occurred
    */
    public static java.util.List<qldc.pm.tienan.model.TienAn> findAll(
        int start, int end)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence().findAll(start, end);
    }

    /**
    * Returns an ordered range of all the tien ans.
    *
    * <p>
    * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link qldc.pm.tienan.model.impl.TienAnModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
    * </p>
    *
    * @param start the lower bound of the range of tien ans
    * @param end the upper bound of the range of tien ans (not inclusive)
    * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
    * @return the ordered range of tien ans
    * @throws SystemException if a system exception occurred
    */
    public static java.util.List<qldc.pm.tienan.model.TienAn> findAll(
        int start, int end,
        com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence().findAll(start, end, orderByComparator);
    }

    /**
    * Removes all the tien ans from the database.
    *
    * @throws SystemException if a system exception occurred
    */
    public static void removeAll()
        throws com.liferay.portal.kernel.exception.SystemException {
        getPersistence().removeAll();
    }

    /**
    * Returns the number of tien ans.
    *
    * @return the number of tien ans
    * @throws SystemException if a system exception occurred
    */
    public static int countAll()
        throws com.liferay.portal.kernel.exception.SystemException {
        return getPersistence().countAll();
    }

    public static TienAnPersistence getPersistence() {
        if (_persistence == null) {
            _persistence = (TienAnPersistence) PortletBeanLocatorUtil.locate(qldc.pm.tienan.service.ClpSerializer.getServletContextName(),
                    TienAnPersistence.class.getName());

            ReferenceRegistry.registerReference(TienAnUtil.class, "_persistence");
        }

        return _persistence;
    }

    /**
     * @deprecated As of 6.2.0
     */
    public void setPersistence(TienAnPersistence persistence) {
    }
}
